/*
 *  quickhull.h
 *  bgsubtraction
 *
 *  Created by a1gucis on 5/14/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef QUICK_HULL
#define QUICK_HULL
#include <vector.h>
#include <iostream.h>
#include <math.h>
#include "contourpixel.h"
using namespace std;
class QuickHull {
//private:
public:
	//calculates euclidean distance
	static int eucDist(int row1, int col1, int row2, int col2);

	//given rowVector and columnVector, recalculates these vectors, so that they contain new values which are to the right
	//or to the left of the given line: row1, col1; row2, col2
	static void divide(vector<int> **rowVector, vector<int> **columnVector, int row1, int col1, int row2, int col2, bool right, int &maxRow, int &maxCol);
	
	static void findHull(vector<int> **rowVector, vector<int> **columnVector, vector<ContourPixel *> *hullPixels, int currentIteration, int totalIterations, int row1, int col1, int row2, int col2, bool right);
	//static void findHull(vector<int> *rowVector, vector<int> *columnVector, vector<int> *rightRows, vector<int> *rightCol, vector<ContourPixel *> *hullPixels, int row1, int col1, int row2, int col2);
//public:
	
	//finds a number of contour pixels, using quick hull algorithm. Input: blobs pixel coordinates.
	static vector<ContourPixel *> *contourPixels(vector<int> *rowVector, vector<int> *columnVector, int topRow, int leftCol, int bottomRow, int rightCol, int iterations);
};

#endif